package com.example.musicserver.service;

import com.example.musicserver.mapper.LoveMusicMapper;
import com.example.musicserver.model.Music;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2025-01-20
 * Time: 15:15
 */
@Service
public class LoveMusicService {
    @Autowired
    private LoveMusicMapper loveMusicMapper;
    public Music findLoveMusicByMusicIdAndUserId(int userId, int musicId) {
         return loveMusicMapper.findLoveMusicByMusicIdAndUserId(musicId, userId);
    }

    public Boolean insertLoveMusic(int userId, int musicId) {
        return loveMusicMapper.insertLoveMusic(userId,musicId);
    }

    public List<Music> findAllLoveMusicByUserId(int userId) {
        return loveMusicMapper.findAllLoveMusicByUserId(userId);
    }
    public List<Music> findLoveMusicByKeyAndUserId(String musicName, int userId) {
        return loveMusicMapper.findLoveMusicByKeyAndUserId(musicName,userId);
    }


    public int deleteLoveMusic(int userId, int musicId) {
        return loveMusicMapper.deleteLoveMusic(userId,musicId);
    }

    public Integer deleteLoveMusicById(int iid) {
        return loveMusicMapper.deleteLoveMusicById(iid);
    }
}
